package com.tc.dao;

import com.tc.entity.ThingsEntity;

import java.util.Date;
import java.util.List;

public class ThingsDao extends BaseDao<Integer, ThingsEntity> {

    public List<ThingsEntity> getAllThings(String id) throws Exception {
        String hql="from ThingsEntity where userId=? and status=0";
        Object[] params={id};
        return executeHQL(hql,params);
    }
    public static void main(String args[]){
        ThingsDao thingsDao=new ThingsDao();
        ThingsEntity thingsEntity=new ThingsEntity();
        thingsEntity.setAddTime(new Date());
        thingsEntity.setName("测试");
        thingsEntity.setStatus(0);
        thingsEntity.setUserId("zekdot");
        try {
            thingsDao.save(thingsEntity);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
